import time

from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
brand_name = '苹果'
testCase = "DBshop022"
firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'商品管理','商品品牌')
#添加品牌
firefox.find_element_by_xpath('//a[contains(text(),"添加品牌")]').click()
#输入品牌信息
firefox.find_element_by_id('brand_name').send_keys(brand_name)
#点击保存
firefox.find_element_by_xpath('//button[contains(text(),"保存品牌")]').click()
time.sleep(3)

try:
    firefox.find_element_by_xpath('//td[contains(text(),"%s")]'%brand_name)
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败"%testCase)
    getPhoto()

firefox.quit()

